package com.magicalcoder.pigeon.common.util;

import com.magicalcoder.pigeon.common.dto.RmtAddress;

/**
 * Created by hzhedongyu on 2017/6/3.
 */
public class RmtAddressUtil {

    public static RmtAddress cover(String hostPortService){
        String reg = "(\\w+)?:(\\d+)/(\\w+)";
        String host = hostPortService.replaceAll(reg,"$1");
        int port = Integer.valueOf(hostPortService.replaceAll(reg,"$2"));
        String sName = hostPortService.replaceAll(reg,"$3");
        return new RmtAddress(host,port,sName);
    }

}
